﻿using Autofac;
using DBContext;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;

namespace ZoneLine.Models
{
    public class HStationEnableConfig
    {
        public int HOP010StationEnable { get; set; }

        public int HOP040StationEnable { get; set; }

        /// <summary>
        /// 工作方向 1 左侧，2 右侧
        /// </summary>
        public int WorkDirection { get; set; }


        private static HStationEnableConfig _paraInfo;

        private static object _lock = new object();

        public static HStationEnableConfig GetPara()
        {
            lock (_lock)
            {
                if (_paraInfo == null)
                {
                    var dal = ContainerServer.Container.Resolve<IModelDAL>();
                    var paraInfo = dal.GetModel<HStationEnableConfig>(p => true);
                    _paraInfo = paraInfo;
                    return _paraInfo;
                }
                else
                {
                    return _paraInfo;
                }
            }

        }

        public static void Reload()
        {
            lock (_lock)
            {
                _paraInfo = null;
            }
        }
    }
}
